package collection;

import java.util.Iterator;
import java.util.TreeSet;

public class TreeSetTest {
    public static void main(String[] args){
        TreeSet<Person> treeSet = new TreeSet<Person>();
        treeSet.add(new Person("张三",1));
        treeSet.add(new Person("李四",12));

        Iterator<Person> iterator = treeSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
